home *** CD-ROM | disk | FTP | other *** search
- From: envbvs@epb2.lbl.gov (Brian V. Smith)
- Newsgroups: comp.sources.x
- Subject: v06i052: xfig 2.0 (part 3/7), Patch5
- Message-ID: <133693@sun.Eng.Sun.COM>
- Date: 30 Mar 90 04:33:06 GMT
- Approved: argv@sun.com
-
- Submitted-by: envbvs@epb2.lbl.gov (Brian V. Smith)
- Posting-number: Volume 6, Issue 52
- Archive-name: xfig2/patch5c
- Patch-To: xfig2: Volume 6, Issue 9-24,34-36
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of archive 3 (of 7)."
- # Contents: draw.c.diff f2ps.c.diff printfonts.c.diff scale.c.diff
- # spline.c.diff xtra.c.diff
- # Wrapped by envbvs@epb2.lbl.gov on Wed Mar 28 09:04:50 1990
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'draw.c.diff' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'draw.c.diff'\"
- else
- echo shar: Extracting \"'draw.c.diff'\" \(10337 characters\)
- sed "s/^X//" >'draw.c.diff' <<'END_OF_FILE'
- X*** draw.c.p5 Thu Mar 1 09:47:45 1990
- X--- draw.c Mon Mar 26 15:40:38 1990
- X***************
- X*** 34,45 ****
- X {
- X F_spline *s;
- X
- X- pw_batch_on(canvas_pixwin);
- X for (s = splines; s != NULL; s = s->next) {
- X if (pointmarker_shown) toggle_splinepointmarker(s);
- X draw_spline(s, ERASE);
- X };
- X- pw_batch_off(canvas_pixwin);
- X }
- X
- X erase_ellipses(ellipses)
- X--- 34,43 ----
- X***************
- X*** 47,58 ****
- X {
- X F_ellipse *e;
- X
- X- pw_batch_on(canvas_pixwin);
- X for (e = ellipses; e != NULL; e = e->next) {
- X if (pointmarker_shown) toggle_ellipsepointmarker(e);
- X draw_ellipse(e, background_color);
- X };
- X- pw_batch_off(canvas_pixwin);
- X }
- X
- X erase_arcs(arcs)
- X--- 45,54 ----
- X***************
- X*** 60,71 ****
- X {
- X F_arc *a;
- X
- X- pw_batch_on(canvas_pixwin);
- X for (a = arcs; a != NULL; a = a->next) {
- X if (pointmarker_shown) toggle_arcpointmarker(a);
- X draw_arc(a, background_color);
- X };
- X- pw_batch_off(canvas_pixwin);
- X }
- X
- X erase_compounds(compounds)
- X--- 56,65 ----
- X***************
- X*** 118,129 ****
- X {
- X F_ellipse *e;
- X
- X- pw_batch_on(canvas_pixwin);
- X for (e = ellipses; e != NULL; e = e->next) {
- X draw_ellipse(e, foreground_color);
- X if (pointmarker_shown) toggle_ellipsepointmarker(e);
- X };
- X- pw_batch_off(canvas_pixwin);
- X }
- X
- X draw_arcs(arcs)
- X--- 112,121 ----
- X***************
- X*** 131,142 ****
- X {
- X F_arc *a;
- X
- X- pw_batch_on(canvas_pixwin);
- X for (a = arcs; a != NULL; a = a->next) {
- X draw_arc(a, foreground_color);
- X if (pointmarker_shown) toggle_arcpointmarker(a);
- X };
- X- pw_batch_off(canvas_pixwin);
- X }
- X
- X draw_lines(lines)
- X--- 123,132 ----
- X***************
- X*** 144,156 ****
- X {
- X F_line *l;
- X
- X- pw_batch_on(canvas_pixwin);
- X for (l = lines; l != NULL; l = l->next) {
- X draw_line(l, PAINT);
- X if (pointmarker_shown)
- X toggle_linepointmarker(l);
- X }
- X- pw_batch_off(canvas_pixwin);
- X }
- X
- X draw_splines(splines)
- X--- 134,144 ----
- X***************
- X*** 158,169 ****
- X {
- X F_spline *s;
- X
- X- pw_batch_on(canvas_pixwin);
- X for (s = splines; s != NULL; s = s->next) {
- X draw_spline(s, PAINT);
- X if (pointmarker_shown) toggle_splinepointmarker(s);
- X };
- X- pw_batch_off(canvas_pixwin);
- X }
- X
- X draw_texts(texts)
- X--- 146,155 ----
- X***************
- X*** 211,218 ****
- X y = yb + wid / 2;
- X xd = x*cosa + y*sina + .5;
- X yd = -x*sina + y*cosa + .5;
- X! pw_vector(canvas_pixwin, xc, yc, x2, y2, op, (int) arrow->thickness);
- X! pw_vector(canvas_pixwin, xd, yd, x2, y2, op, (int) arrow->thickness);
- X }
- X
- X draw_spline(spline, op)
- X--- 197,206 ----
- X y = yb + wid / 2;
- X xd = x*cosa + y*sina + .5;
- X yd = -x*sina + y*cosa + .5;
- X! pw_vector(canvas_pixwin, xc, yc, x2, y2, op,
- X! (int) arrow->thickness, arrow->style, 0.0);
- X! pw_vector(canvas_pixwin, xd, yd, x2, y2, op,
- X! (int) arrow->thickness, arrow->style, 0.0);
- X }
- X
- X draw_spline(spline, op)
- X***************
- X*** 279,288 ****
- X F_line *line;
- X int op;
- X {
- X! F_point *point;
- X! int xx, yy, x, y;
- X
- X! /* added 3/1/89 B.V.Smith */
- X fill_object(line,op);
- X
- X if (line->type == T_ARC_BOX) /* box with rounded corners */
- X--- 267,278 ----
- X F_line *line;
- X int op;
- X {
- X! F_point *point;
- X! XPoint *points, *pptr;
- X! int npoints;
- X! int xx, yy, x, y;
- X
- X! /* fill the object first then draw outline */
- X fill_object(line,op);
- X
- X if (line->type == T_ARC_BOX) /* box with rounded corners */
- X***************
- X*** 292,297 ****
- X--- 282,288 ----
- X }
- X
- X point = line->points;
- X+ /* get and save first point */
- X x = point->x;
- X y = point->y;
- X if (line->points->next == NULL) { /* A single point */
- X***************
- X*** 301,397 ****
- X if (line->back_arrow) /* backward arrow */
- X draw_arrow(point->next->x, point->next->y, x, y,
- X line->back_arrow, op);
- X! for (point = point->next; point != NULL; point = point->next) {
- X! draw_line_segment(line->style, line->style_val,
- X! x, y, point->x, point->y, op, line->thickness);
- X xx = x; yy = y;
- X x = point->x;
- X y = point->y;
- X }
- X if (line->for_arrow)
- X draw_arrow(xx, yy, x, y, line->for_arrow, op);
- X }
- X
- X- #define round(x) ((int)((x) + .5))
- X- #define dash_length style_val
- X- #define dot_gap style_val
- X-
- X- draw_line_segment(line_style, style_val, x1, y1, x2, y2, op, thick)
- X- int line_style, x1, y1, x2, y2, op, thick;
- X- float style_val;
- X- {
- X- switch (line_style) {
- X- case SOLID_LINE :
- X- pw_vector(canvas_pixwin, x1, y1, x2, y2, op, thick);
- X- break;
- X- case DASH_LINE : {
- X- float x, y, leng, dx, dy, dash_x, dash_y;
- X- float spacing_leng, space_x, space_y;
- X- int num_spacing;
- X-
- X- dx = x2 - x1;
- X- dy = y2 - y1;
- X- leng = sqrt((double)(dx*dx + dy*dy));
- X- if(leng == 0)
- X- break;
- X- if (leng <= dash_length) {
- X- pw_vector(canvas_pixwin, x1, y1, x2, y2, op, thick);
- X- break;
- X- }
- X- dash_x = dash_length * dx / leng;
- X- dash_y = dash_length * dy / leng;
- X- num_spacing = (leng - dash_length) / (2 * dash_length);
- X- if (num_spacing == 0)
- X- spacing_leng = leng;
- X- else
- X- spacing_leng = (leng - dash_length * (num_spacing + 1)) /
- X- ((float)num_spacing);
- X- space_x = spacing_leng * dx / leng;
- X- space_y = spacing_leng * dy / leng;
- X- dx = dash_x + space_x; dy = dash_y + space_y;
- X- for (x = x1, y = y1; leng > 0;
- X- x += dx, y += dy, leng -= dash_length + spacing_leng) {
- X- pw_vector(canvas_pixwin, round(x), round(y),
- X- round(x + dash_x), round(y + dash_y), op, thick);
- X- }
- X- break;
- X- }
- X- case DOTTED_LINE : {
- X- float x, y, leng, dx, dy, gap_x, gap_y;
- X- int n, color;
- X-
- X- dot_gap += 1.0;
- X- dx = x2 - x1;
- X- dy = y2 - y1;
- X- leng = sqrt((double)(dx*dx + dy*dy)) - 1;
- X- n = round(leng/dot_gap);
- X- if (op == PAINT)
- X- color = foreground_color;
- X- else
- X- color = background_color;
- X- if (n <= 1) {
- X- /*
- X- pw_vector(canvas_pixwin, x1, y1, x1, y1, op, thick);
- X- */
- X- pw_put(canvas_pixwin, x1, y1, color, thick);
- X- pw_put(canvas_pixwin, x2, y2, color, thick);
- X- break;
- X- }
- X- if(leng == 0)
- X- break;
- X- dot_gap = leng / n;
- X- gap_x = dot_gap * dx / leng;
- X- gap_y = dot_gap * dy / leng;
- X- for (x = x1, y = y1; n-- >= 0; x += gap_x, y += gap_y)
- X- /*
- X- pw_vector(canvas_pixwin,round(x),round(y),round(x),round(y),op,thick);
- X- */
- X- pw_put(canvas_pixwin, round(x), round(y), color, thick);
- X- break;
- X- }
- X- }
- X- }
- X-
- X draw_arc_box(line, op)
- X F_line *line;
- X int op;
- X--- 292,337 ----
- X if (line->back_arrow) /* backward arrow */
- X draw_arrow(point->next->x, point->next->y, x, y,
- X line->back_arrow, op);
- X! if (line->style == SOLID_LINE) /* accumulate the points for solid line */
- X! {
- X! npoints = 0;
- X! /* count number of points in this object */
- X! for ( ; point != NULL; point = point->next)
- X! npoints++;
- X! /* accumulate the points in an array */
- X! if ((points = (XPoint *) malloc(npoints*sizeof(XPoint))) == 0)
- X! {
- X! fprintf(stderr,"draw_line(): No memory\n");
- X! return;
- X! }
- X! pptr = points;
- X! }
- X! for (point=line->points; point != NULL; point = point->next) {
- X! if (line->style == SOLID_LINE)
- X! {
- X! pptr->x = point->x;
- X! pptr->y = point->y;
- X! pptr++;
- X! }
- X! else /* draw dashed or dotted line segment by segment
- X! otherwise when moving one segment later there
- X! is an alignment problem with the dashes */
- X! pw_vector(canvas_pixwin, x, y, point->x, point->y, op,
- X! line->thickness, line->style, line->style_val);
- X xx = x; yy = y;
- X x = point->x;
- X y = point->y;
- X }
- X+ if (line->style == SOLID_LINE)
- X+ {
- X+ pw_lines(canvas_pixwin, points, npoints, op,
- X+ line->thickness, line->style, line->style_val, 0);
- X+ free(points);
- X+ }
- X if (line->for_arrow)
- X draw_arrow(xx, yy, x, y, line->for_arrow, op);
- X }
- X
- X draw_arc_box(line, op)
- X F_line *line;
- X int op;
- X***************
- X*** 400,411 ****
- X int xmin,xmax,ymin,ymax;
- X int pop, thick, style;
- X float val;
- X! int radius;
- X
- X point = line->points;
- X style = line->style;
- X val = line->style_val;
- X- thick = line->thickness;
- X radius = line->pen; /* hopefully temporary */
- X pop = (op == ERASE)? background_color: foreground_color;
- X
- X--- 340,355 ----
- X int xmin,xmax,ymin,ymax;
- X int pop, thick, style;
- X float val;
- X! int radius,diam;
- X! XGCValues gcv;
- X! GC gc;
- X
- X+ thick = line->thickness;
- X+ if (thick == 0)
- X+ return;
- X point = line->points;
- X style = line->style;
- X val = line->style_val;
- X radius = line->pen; /* hopefully temporary */
- X pop = (op == ERASE)? background_color: foreground_color;
- X
- X***************
- X*** 423,438 ****
- X else if (point->y > ymax)
- X ymax = point->y;
- X }
- X! curve(canvas_pixwin, 0, radius, -radius, 0, 1, 1, 1,
- X! xmin+radius, ymin+radius, pop, thick, 0);
- X! draw_line_segment(style, val, xmin, ymin+radius, xmin, ymax-radius+1, op, thick);
- X! curve(canvas_pixwin, -radius, 0, 0, -radius, 1, 1, 1,
- X! xmin+radius, ymax-radius, pop, thick, 0);
- X! draw_line_segment(style, val, xmin+radius, ymax, xmax-radius+1, ymax,op, thick);
- X! curve(canvas_pixwin, 0, -radius, radius, 0, 1, 1, 1,
- X! xmax-radius, ymax-radius, pop, thick, 0);
- X! draw_line_segment(style, val, xmax, ymax-radius, xmax, ymin+radius-1, op, thick);
- X! curve(canvas_pixwin, radius, 0, 0, radius, 1, 1, 1,
- X! xmax-radius, ymin+radius, pop, thick, 0);
- X! draw_line_segment(style, val, xmax-radius, ymin, xmin+radius-1, ymin, op, thick);
- X }
- X--- 367,385 ----
- X else if (point->y > ymax)
- X ymax = point->y;
- X }
- X! set_line_stuff(thick,style,val,op);
- X! gc = gccache[op];
- X! diam = 2*radius;
- X! XDrawArc(tool_d, canvas_pixwin, gc, xmin, ymin,
- X! diam, diam, 90*64, 90*64);
- X! XDrawLine(tool_d, canvas_pixwin, gc, xmin, ymin+radius, xmin, ymax-radius+1);
- X! XDrawArc(tool_d, canvas_pixwin, gc, xmin, ymax-diam,
- X! diam, diam, 180*64, 90*64);
- X! XDrawLine(tool_d, canvas_pixwin, gc, xmin+radius, ymax, xmax-radius+1, ymax);
- X! XDrawArc(tool_d, canvas_pixwin, gc, xmax-diam, ymax-diam,
- X! diam, diam, 270*64, 90*64);
- X! XDrawLine(tool_d, canvas_pixwin, gc, xmax, ymax-radius, xmax, ymin+radius-1);
- X! XDrawArc(tool_d, canvas_pixwin, gc, xmax-diam, ymin,
- X! diam, diam, 0*64, 90*64);
- X! XDrawLine(tool_d, canvas_pixwin, gc, xmax-radius, ymin, xmin+radius-1, ymin);
- X }
- END_OF_FILE
- if test 10337 -ne `wc -c <'draw.c.diff'`; then
- echo shar: \"'draw.c.diff'\" unpacked with wrong size!
- fi
- # end of 'draw.c.diff'
- fi
- if test -f 'f2ps.c.diff' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'f2ps.c.diff'\"
- else
- echo shar: Extracting \"'f2ps.c.diff'\" \(7690 characters\)
- sed "s/^X//" >'f2ps.c.diff' <<'END_OF_FILE'
- X*** f2ps.c.p5 Fri Mar 2 13:06:01 1990
- X--- f2ps.c Tue Mar 27 09:44:17 1990
- X***************
- X*** 410,417 ****
- X p = l->points;
- X q = p->next;
- X if (q == NULL) { /* A single point line */
- X! fprintf(tfp, "newpath %d %d moveto %d %d lineto stroke\n",
- X p->x, p->y, p->x, p->y);
- X return;
- X }
- X if (l->back_arrow)
- X--- 410,421 ----
- X p = l->points;
- X q = p->next;
- X if (q == NULL) { /* A single point line */
- X! if (l->thickness > 0)
- X! fprintf(tfp, "newpath %d %d moveto %d %d lineto stroke\n",
- X p->x, p->y, p->x, p->y);
- X+ else
- X+ fprintf(tfp, "newpath %d %d moveto %d %d lineto\n",
- X+ p->x, p->y, p->x, p->y);
- X return;
- X }
- X if (l->back_arrow)
- X***************
- X*** 419,425 ****
- X (float)p->y, l->back_arrow->ht, l->back_arrow->wid);
- X set_style(l->style, l->style_val);
- X fprintf(tfp, "%% Polyline\n");
- X! if (l->type == T_ARC_BOX)
- X {
- X register int xmin,xmax,ymin,ymax;
- X
- X--- 423,429 ----
- X (float)p->y, l->back_arrow->ht, l->back_arrow->wid);
- X set_style(l->style, l->style_val);
- X fprintf(tfp, "%% Polyline\n");
- X! if (l->type == T_ARC_BOX) /* rounded-corner box */
- X {
- X register int xmin,xmax,ymin,ymax;
- X
- X***************
- X*** 453,470 ****
- X while (q->next != NULL) {
- X p = q;
- X q = q->next;
- X! if (l->type == T_ARC_BOX)
- X! {
- X! fprintf(tfp," %d %d %d %d %d arcto 4 {pop} repeat",
- X! p->x,p->y,q->x,q->y,radius);
- X! fprintf(tfp," 4 { pop } repeat");
- X! }
- X! else
- X! fprintf(tfp, " %d %d lineto", p->x, p->y);
- X }
- X }
- X if (l->type == T_POLYLINE)
- X! fprintf(tfp, " %d %d lineto stroke\n", q->x, q->y);
- X else
- X {
- X fprintf(tfp, " closepath ");
- X--- 457,472 ----
- X while (q->next != NULL) {
- X p = q;
- X q = q->next;
- X! fprintf(tfp, " %d %d lineto", p->x, p->y);
- X }
- X }
- X if (l->type == T_POLYLINE)
- X! {
- X! if (l->thickness > 0)
- X! fprintf(tfp, " %d %d lineto stroke\n", q->x, q->y);
- X! else
- X! fprintf(tfp, " %d %d lineto\n", q->x, q->y);
- X! }
- X else
- X {
- X fprintf(tfp, " closepath ");
- X***************
- X*** 474,484 ****
- X fprintf(tfp, " gsave fill grestore ");
- X set_areafill(NUMFILLPATS); /* back to black line */
- X }
- X! fprintf(tfp, " stroke\n");
- X }
- X
- X reset_style(l->style, l->style_val);
- X! if (l->for_arrow)
- X draw_arrow_head((float)p->x, (float)p->y, (float)q->x,
- X (float)q->y, l->for_arrow->ht, l->for_arrow->wid);
- X }
- X--- 476,487 ----
- X fprintf(tfp, " gsave fill grestore ");
- X set_areafill(NUMFILLPATS); /* back to black line */
- X }
- X! if (l->thickness > 0)
- X! fprintf(tfp, " stroke\n");
- X }
- X
- X reset_style(l->style, l->style_val);
- X! if (l->for_arrow && l->thickness > 0)
- X draw_arrow_head((float)p->x, (float)p->y, (float)q->x,
- X (float)q->y, l->for_arrow->ht, l->for_arrow->wid);
- X }
- X***************
- X*** 508,514 ****
- X a = s->controls;
- X b = a->next;
- X p = s->points;
- X! if (s->back_arrow)
- X draw_arrow_head(b->lx, b->ly, (float)p->x,
- X (float)p->y, s->back_arrow->ht, s->back_arrow->wid);
- X
- X--- 511,517 ----
- X a = s->controls;
- X b = a->next;
- X p = s->points;
- X! if (s->back_arrow && s->thickness > 0)
- X draw_arrow_head(b->lx, b->ly, (float)p->x,
- X (float)p->y, s->back_arrow->ht, s->back_arrow->wid);
- X
- X***************
- X*** 532,541 ****
- X set_areafill(NUMFILLPATS); /* back to black for line */
- X }
- X }
- X! fprintf(tfp, " stroke\n");
- X reset_style(s->style, s->style_val);
- X
- X! if (s->for_arrow)
- X draw_arrow_head(a->lx, a->ly, (float)p->x,
- X (float)p->y, s->for_arrow->ht, s->for_arrow->wid);
- X }
- X--- 535,545 ----
- X set_areafill(NUMFILLPATS); /* back to black for line */
- X }
- X }
- X! if (s->thickness > 0)
- X! fprintf(tfp, " stroke\n");
- X reset_style(s->style, s->style_val);
- X
- X! if (s->for_arrow && s->thickness > 0)
- X draw_arrow_head(a->lx, a->ly, (float)p->x,
- X (float)p->y, s->for_arrow->ht, s->for_arrow->wid);
- X }
- X***************
- X*** 565,571 ****
- X set_linewidth(s->thickness);
- X x3 = a = (x1 + c) / 2;
- X y3 = b = (y1 + d) / 2;
- X! if (s->back_arrow) {
- X draw_arrow_head(c, d, x1, y1, s->back_arrow->ht, s->back_arrow->wid);
- X }
- X set_style(s->style, s->style_val);
- X--- 569,575 ----
- X set_linewidth(s->thickness);
- X x3 = a = (x1 + c) / 2;
- X y3 = b = (y1 + d) / 2;
- X! if (s->back_arrow && s->thickness > 0) {
- X draw_arrow_head(c, d, x1, y1, s->back_arrow->ht, s->back_arrow->wid);
- X }
- X set_style(s->style, s->style_val);
- X***************
- X*** 600,612 ****
- X fprintf(tfp, " gsave fill grestore\n");
- X set_areafill(NUMFILLPATS); /* back to black for line */
- X }
- X! fprintf(tfp, " stroke\n");
- X }
- X else {
- X! fprintf(tfp, "\t%.3f %.3f lineto stroke\n", c, d);
- X }
- X reset_style(s->style, s->style_val);
- X! if (s->for_arrow) {
- X draw_arrow_head(x2, y2, c, d, s->for_arrow->ht,
- X s->for_arrow->wid);
- X }
- X--- 604,621 ----
- X fprintf(tfp, " gsave fill grestore\n");
- X set_areafill(NUMFILLPATS); /* back to black for line */
- X }
- X! if (s->thickness > 0)
- X! fprintf(tfp, " stroke\n");
- X }
- X else {
- X! if (s->thickness > 0)
- X! fprintf(tfp, "\t%.3f %.3f lineto stroke\n", c, d);
- X! else
- X! fprintf(tfp, "\t%.3f %.3f lineto\n", c, d);
- X }
- X reset_style(s->style, s->style_val);
- X! if (s->for_arrow && s->thickness > 0)
- X! {
- X draw_arrow_head(x2, y2, c, d, s->for_arrow->ht,
- X s->for_arrow->wid);
- X }
- X***************
- X*** 631,637 ****
- X fprintf(tfp, " gsave fill grestore\n");
- X set_areafill(NUMFILLPATS); /* back to black for line */
- X }
- X! fprintf(tfp, " stroke\n");
- X reset_style(e->style, e->style_val);
- X }
- X
- X--- 640,647 ----
- X fprintf(tfp, " gsave fill grestore\n");
- X set_areafill(NUMFILLPATS); /* back to black for line */
- X }
- X! if (e->thickness > 0)
- X! fprintf(tfp, " stroke\n");
- X reset_style(e->style, e->style_val);
- X }
- X
- X***************
- X*** 725,735 ****
- X else
- X direction = a->direction;
- X set_linewidth(a->thickness);
- X! if (a->for_arrow) {
- X arc_tangent(cx, cy, ex, ey, direction, &x, &y);
- X draw_arrow_head(x, y, ex, ey, a->for_arrow->ht, a->for_arrow->wid);
- X }
- X! if (a->back_arrow) {
- X arc_tangent(cx, cy, sx, sy, !direction, &x, &y);
- X draw_arrow_head(x, y, sx, sy, a->back_arrow->ht, a->back_arrow->wid);
- X }
- X--- 735,745 ----
- X else
- X direction = a->direction;
- X set_linewidth(a->thickness);
- X! if (a->for_arrow && a->thickness > 0) {
- X arc_tangent(cx, cy, ex, ey, direction, &x, &y);
- X draw_arrow_head(x, y, ex, ey, a->for_arrow->ht, a->for_arrow->wid);
- X }
- X! if (a->back_arrow && a->thickness > 0) {
- X arc_tangent(cx, cy, sx, sy, !direction, &x, &y);
- X draw_arrow_head(x, y, sx, sy, a->back_arrow->ht, a->back_arrow->wid);
- X }
- X***************
- X*** 740,748 ****
- X angle2 = atan2(ey-cy, ex-cx) * 180 / M_PI;
- X /* direction = 1 -> Counterclockwise */
- X set_style(a->style, a->style_val);
- X! fprintf(tfp, "newpath %.3f %.3f %.3f %.3f %.3f %s stroke\n",
- X cx, cy, radius, angle1, angle2,
- X ((direction == 1) ? "arc" : "arcn"));
- X reset_style(a->style, a->style_val);
- X }
- X
- X--- 750,766 ----
- X angle2 = atan2(ey-cy, ex-cx) * 180 / M_PI;
- X /* direction = 1 -> Counterclockwise */
- X set_style(a->style, a->style_val);
- X! fprintf(tfp, "newpath %.3f %.3f %.3f %.3f %.3f %s\n",
- X cx, cy, radius, angle1, angle2,
- X ((direction == 1) ? "arc" : "arcn"));
- X+ if (a->area_fill)
- X+ {
- X+ set_areafill(a->area_fill);
- X+ fprintf(tfp, " closepath gsave fill grestore\n");
- X+ set_areafill(NUMFILLPATS); /* back to black for line */
- X+ }
- X+ if (a->thickness > 0)
- X+ fprintf(tfp," stroke\n");
- X reset_style(a->style, a->style_val);
- X }
- X
- END_OF_FILE
- if test 7690 -ne `wc -c <'f2ps.c.diff'`; then
- echo shar: \"'f2ps.c.diff'\" unpacked with wrong size!
- fi
- # end of 'f2ps.c.diff'
- fi
- if test -f 'printfonts.c.diff' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'printfonts.c.diff'\"
- else
- echo shar: Extracting \"'printfonts.c.diff'\" \(6160 characters\)
- sed "s/^X//" >'printfonts.c.diff' <<'END_OF_FILE'
- X*** printfonts.c.p5 Fri Mar 9 16:48:55 1990
- X--- printfonts.c Tue Mar 20 17:42:28 1990
- X***************
- X*** 34,44 ****
- X
- X static Arg fontmenu_args[] =
- X {
- X! /* 0 */{ XtNx, (XtArgVal) 0 },
- X! /* 1 */{ XtNy, (XtArgVal) 0 },
- X! /* 2 */{ XtNwidth, (XtArgVal) 0 },
- X! /* 3 */{ XtNheight, (XtArgVal) 0 },
- X! /* 4 */{ XtNvSpace, (XtArgVal) 1 },
- X };
- X
- X extern void fontpane_select();
- X--- 34,40 ----
- X
- X static Arg fontmenu_args[] =
- X {
- X! { XtNvSpace, (XtArgVal) 1 },
- X };
- X
- X extern void fontpane_select();
- X***************
- X*** 51,90 ****
- X
- X static Arg main_pane_args[] =
- X {
- X! /* 0 */ { XtNx, (XtArgVal)10 },
- X! /* 1 */ { XtNy, (XtArgVal)30 },
- X! /* 2 */ { XtNlabel, (XtArgVal)" " },
- X! /* 3 */ { XtNwidth, (XtArgVal) FONT_PANE_WIDTH },
- X };
- X
- X static Arg pane_args[] =
- X {
- X! /* 0 */ { XtNx, (XtArgVal) 0 },
- X! /* 1 */ { XtNy, (XtArgVal) 0 },
- X! /* 2 */ { XtNwidth, (XtArgVal) FONT_PANE_WIDTH },
- X! /* 3 */ { XtNheight, (XtArgVal) 20 },
- X! /* 4 */ { XtNcallback, (XtArgVal)pane_callbacks },
- X! /* 5 */ { XtNbitmap, (XtArgVal) NULL },
- X! /* 6 */ { XtNinternalWidth, (XtArgVal) 0 }, /* space between pixmap and edge */
- X! /* 7 */ { XtNinternalHeight, (XtArgVal) 0 },
- X! /* 8 */ { XtNresize, (XtArgVal) FALSE }, /* don't allow resize */
- X };
- X
- X static Arg psfont_args[] =
- X {
- X! /* 0 */ { XtNx, (XtArgVal)0 },
- X! /* 1 */ { XtNy, (XtArgVal)0 },
- X! /* 2 */ { XtNwidth, (XtArgVal) FONT_PANE_WIDTH },
- X! /* 3 */ { XtNheight, (XtArgVal) MSG_HEIGHT }, /* same height as message panel */
- X! /* 4 */ { XtNfromHoriz, (XtArgVal) NULL }, /* left side of main form */
- X! /* 5 */ { XtNhorizDistance, (XtArgVal) SWITCH_ICON_SPACING },
- X! /* 6 */ { XtNfromVert, (XtArgVal) NULL },
- X! /* 7 */ { XtNvertDistance, (XtArgVal) 1 }, /* dist from canvas_sw window */
- X! /* 8 */ { XtNbitmap, (XtArgVal) NULL },
- X! /* 9 */ { XtNinternalWidth, (XtArgVal) 0 }, /* space between pixmap and edge */
- X! /*10 */ { XtNinternalHeight, (XtArgVal) 0 },
- X! /*11 */ { XtNleft, (XtArgVal) XtChainLeft },
- X! /*12 */ { XtNright, (XtArgVal) XtChainLeft },
- X };
- X
- X static TOOL fontpanes;
- X--- 47,80 ----
- X
- X static Arg main_pane_args[] =
- X {
- X! /* 0 */ { XtNlabel, (XtArgVal)" " },
- X! /* 1 */ { XtNwidth, (XtArgVal) FONT_PANE_WIDTH },
- X };
- X
- X static Arg pane_args[] =
- X {
- X! /* 0 */ { XtNwidth, (XtArgVal) FONT_PANE_WIDTH },
- X! /* 1 */ { XtNheight, (XtArgVal) 20 },
- X! /* 2 */ { XtNcallback, (XtArgVal)pane_callbacks },
- X! /* 3 */ { XtNbitmap, (XtArgVal) NULL },
- X! /* 4 */ { XtNinternalWidth, (XtArgVal) 0 }, /* space between pixmap and edge */
- X! /* 5 */ { XtNinternalHeight, (XtArgVal) 0 },
- X! /* 6 */ { XtNresize, (XtArgVal) FALSE }, /* don't allow resize */
- X };
- X
- X static Arg psfont_args[] =
- X {
- X! /* 0 */ { XtNwidth, (XtArgVal) FONT_PANE_WIDTH },
- X! /* 1 */ { XtNheight, (XtArgVal) MSG_HEIGHT }, /* same height as message panel */
- X! /* 2 */ { XtNfromHoriz, (XtArgVal) NULL }, /* left side of main form */
- X! /* 3 */ { XtNhorizDistance, (XtArgVal) 1 },
- X! /* 4 */ { XtNfromVert, (XtArgVal) NULL },
- X! /* 5 */ { XtNvertDistance, (XtArgVal) -1 }, /* dist from canvas_sw window */
- X! /* 6 */ { XtNbitmap, (XtArgVal) NULL },
- X! /* 8 */ { XtNinternalWidth, (XtArgVal) 0 }, /* space between pixmap and edge */
- X! /* 8 */ { XtNinternalHeight, (XtArgVal) 0 },
- X! /* 9 */ { XtNleft, (XtArgVal) XtChainLeft },
- X! /*10 */ { XtNright, (XtArgVal) XtChainLeft },
- X };
- X
- X static TOOL fontpanes;
- X***************
- X*** 118,124 ****
- X mi = &fontmenu_items[i];
- X }
- X
- X! main_pane_args[2].value = (XtArgVal)"Printer Fonts";
- X title = XtCreateManagedWidget("title", labelWidgetClass,
- X fontpanes, main_pane_args, XtNumber(main_pane_args));
- X
- X--- 108,114 ----
- X mi = &fontmenu_items[i];
- X }
- X
- X! main_pane_args[0].value = (XtArgVal)"Printer Fonts";
- X title = XtCreateManagedWidget("title", labelWidgetClass,
- X fontpanes, main_pane_args, XtNumber(main_pane_args));
- X
- X***************
- X*** 143,149 ****
- X /* Now set up the font indicator window */
- X
- X /* position */
- X! psfont_args[6].value = (XtArgVal)canvas_sw; /* just below the canvas window */
- X psfont = XtCreateManagedWidget("font_indicator", labelWidgetClass, tool,
- X psfont_args, XtNumber(psfont_args));
- X return (1);
- X--- 133,139 ----
- X /* Now set up the font indicator window */
- X
- X /* position */
- X! psfont_args[4].value = (XtArgVal)canvas_sw; /* just below the canvas window */
- X psfont = XtCreateManagedWidget("font_indicator", labelWidgetClass, tool,
- X psfont_args, XtNumber(psfont_args));
- X return (1);
- X***************
- X*** 161,174 ****
- X for (i=0; i<NUMFONTS; i++)
- X font_menu_bitmaps[i] = XCreateBitmapFromData(tool_d,XtWindow(psfont),
- X font_menu_bits[i], FONT_PANE_WIDTH, FONT_PANE_HEIGHT);
- X! psfont_args[8].value = (XtArgVal) font_menu_bitmaps[0];
- X! XtSetValues(psfont, &psfont_args[8], 1); /* show default font in window */
- X
- X /* Store the bitmaps in the menu panes */
- X for (i=0; i< NUMFONTS; i++)
- X {
- X! pane_args[5].value = (XtArgVal) font_menu_bitmaps[i];
- X! XtSetValues(fontpane[i], &pane_args[5], 1); /* bitmap */
- X }
- X }
- X
- X--- 151,164 ----
- X for (i=0; i<NUMFONTS; i++)
- X font_menu_bitmaps[i] = XCreateBitmapFromData(tool_d,XtWindow(psfont),
- X font_menu_bits[i], FONT_PANE_WIDTH, FONT_PANE_HEIGHT);
- X! psfont_args[6].value = (XtArgVal) font_menu_bitmaps[0];
- X! XtSetValues(psfont, &psfont_args[6], 1); /* show default font in window */
- X
- X /* Store the bitmaps in the menu panes */
- X for (i=0; i< NUMFONTS; i++)
- X {
- X! pane_args[3].value = (XtArgVal) font_menu_bitmaps[i];
- X! XtSetValues(fontpane[i], &pane_args[3], 1); /* bitmap */
- X }
- X }
- X
- X***************
- X*** 198,204 ****
- X font_button = (int) mi->info;
- X put_msg("Font: %s",font_name);
- X /* put image of font in indicator window */
- X! psfont_args[8].value = (XtArgVal) font_menu_bitmaps[font_button];
- X! XtSetValues(psfont, &psfont_args[8], 1);
- X XtPopdown(fontmenu);
- X }
- X--- 188,194 ----
- X font_button = (int) mi->info;
- X put_msg("Font: %s",font_name);
- X /* put image of font in indicator window */
- X! psfont_args[6].value = (XtArgVal) font_menu_bitmaps[font_button];
- X! XtSetValues(psfont, &psfont_args[6], 1);
- X XtPopdown(fontmenu);
- X }
- END_OF_FILE
- if test 6160 -ne `wc -c <'printfonts.c.diff'`; then
- echo shar: \"'printfonts.c.diff'\" unpacked with wrong size!
- fi
- # end of 'printfonts.c.diff'
- fi
- if test -f 'scale.c.diff' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'scale.c.diff'\"
- else
- echo shar: Extracting \"'scale.c.diff'\" \(6874 characters\)
- sed "s/^X//" >'scale.c.diff' <<'END_OF_FILE'
- X*** scale.c.p5 Tue Jan 16 17:21:04 1990
- X--- scale.c Thu Mar 15 15:28:52 1990
- X***************
- X*** 34,40 ****
- X
- X static enum {WEST, NORTH, EAST, SOUTH, CORNER} side;
- X static int save_coord;
- X! static F_compound *compound;
- X static double cosa, sina;
- X static int fromx, fromy;
- X init_scale_compound();
- X--- 34,40 ----
- X
- X static enum {WEST, NORTH, EAST, SOUTH, CORNER} side;
- X static int save_coord;
- X! static F_compound *cmpnd;
- X static double cosa, sina;
- X static int fromx, fromy;
- X init_scale_compound();
- X***************
- X*** 55,71 ****
- X {
- X double dx, dy, l;
- X
- X! if ((compound = compound_point_search(x, y, TOLERANCE, &cur_x,
- X &cur_y)) != NULL)
- X {
- X! if (compound->nwcorner.x == cur_x)
- X! fix_x = compound->secorner.x;
- X else
- X! fix_x = compound->nwcorner.x;
- X! if (compound->nwcorner.y == cur_y)
- X! fix_y = compound->secorner.y;
- X else
- X! fix_y = compound->nwcorner.y;
- X
- X side = CORNER;
- X dx = cur_x - fix_x; dy = cur_y - fix_y;
- X--- 55,71 ----
- X {
- X double dx, dy, l;
- X
- X! if ((cmpnd = compound_point_search(x, y, TOLERANCE, &cur_x,
- X &cur_y)) != NULL)
- X {
- X! if (cmpnd->nwcorner.x == cur_x)
- X! fix_x = cmpnd->secorner.x;
- X else
- X! fix_x = cmpnd->nwcorner.x;
- X! if (cmpnd->nwcorner.y == cur_y)
- X! fix_y = cmpnd->secorner.y;
- X else
- X! fix_y = cmpnd->nwcorner.y;
- X
- X side = CORNER;
- X dx = cur_x - fix_x; dy = cur_y - fix_y;
- X***************
- X*** 74,82 ****
- X
- X fromx = cur_x; fromy = cur_y;
- X win_setmouseposition(canvas_swfd, cur_x, cur_y);
- X! draw_compoundbox(compound, INV_PAINT);
- X! draw_rectbox(fix_x, fix_y, cur_x, cur_y, INV_PAINT, 1);
- X! set_latestcompound(compound);
- X canvas_locmove_proc = elastic_compoundbox;
- X canvas_middlebut_proc = prescale_compound;
- X canvas_leftbut_proc = canvas_rightbut_proc = null_proc;
- X--- 74,82 ----
- X
- X fromx = cur_x; fromy = cur_y;
- X win_setmouseposition(canvas_swfd, cur_x, cur_y);
- X! draw_compoundbox(cmpnd, INV_PAINT);
- X! draw_rectbox(fix_x, fix_y, cur_x, cur_y, INV_PAINT);
- X! set_latestcompound(cmpnd);
- X canvas_locmove_proc = elastic_compoundbox;
- X canvas_middlebut_proc = prescale_compound;
- X canvas_leftbut_proc = canvas_rightbut_proc = null_proc;
- X***************
- X*** 84,100 ****
- X set_temp_cursor(&null_cursor);
- X win_setmouseposition(canvas_swfd, x, y);
- X }
- X! else if ((compound = compound_search(x, y, TOLERANCE, &cur_x, &cur_y))
- X != NULL )
- X {
- X /* figure out which side the cursor is close to. */
- X! if (compound->nwcorner.x == cur_x)
- X side = WEST;
- X! else if (compound->nwcorner.y == cur_y)
- X side = NORTH;
- X! else if (compound->secorner.x == cur_x)
- X side = EAST;
- X! else if (compound->secorner.y == cur_y)
- X side = SOUTH;
- X else
- X return;
- X--- 84,100 ----
- X set_temp_cursor(&null_cursor);
- X win_setmouseposition(canvas_swfd, x, y);
- X }
- X! else if ((cmpnd = compound_search(x, y, TOLERANCE, &cur_x, &cur_y))
- X != NULL )
- X {
- X /* figure out which side the cursor is close to. */
- X! if (cmpnd->nwcorner.x == cur_x)
- X side = WEST;
- X! else if (cmpnd->nwcorner.y == cur_y)
- X side = NORTH;
- X! else if (cmpnd->secorner.x == cur_x)
- X side = EAST;
- X! else if (cmpnd->secorner.y == cur_y)
- X side = SOUTH;
- X else
- X return;
- X***************
- X*** 103,119 ****
- X switch (side) {
- X case WEST:
- X case NORTH:
- X! fix_x = compound->secorner.x;
- X! fix_y = compound->secorner.y;
- X! cur_x = compound->nwcorner.x;
- X! cur_y = compound->nwcorner.y;
- X break;
- X case EAST:
- X case SOUTH:
- X! fix_x = compound->nwcorner.x;
- X! fix_y = compound->nwcorner.y;
- X! cur_x = compound->secorner.x;
- X! cur_y = compound->secorner.y;
- X break;
- X }
- X
- X--- 103,119 ----
- X switch (side) {
- X case WEST:
- X case NORTH:
- X! fix_x = cmpnd->secorner.x;
- X! fix_y = cmpnd->secorner.y;
- X! cur_x = cmpnd->nwcorner.x;
- X! cur_y = cmpnd->nwcorner.y;
- X break;
- X case EAST:
- X case SOUTH:
- X! fix_x = cmpnd->nwcorner.x;
- X! fix_y = cmpnd->nwcorner.y;
- X! cur_x = cmpnd->secorner.x;
- X! cur_y = cmpnd->secorner.y;
- X break;
- X }
- X
- X***************
- X*** 131,139 ****
- X }
- X /* erase the compound box. */
- X win_setmouseposition(canvas_swfd, cur_x, cur_y);
- X! draw_compoundbox(compound, INV_PAINT);
- X! draw_rectbox(fix_x, fix_y, cur_x, cur_y, INV_PAINT, 1);
- X! set_latestcompound(compound);
- X canvas_locmove_proc = elastic_compoundbox;
- X canvas_middlebut_proc = prescale_compound;
- X canvas_leftbut_proc = canvas_rightbut_proc = null_proc;
- X--- 131,139 ----
- X }
- X /* erase the compound box. */
- X win_setmouseposition(canvas_swfd, cur_x, cur_y);
- X! draw_compoundbox(cmpnd, INV_PAINT);
- X! draw_rectbox(fix_x, fix_y, cur_x, cur_y, INV_PAINT);
- X! set_latestcompound(cmpnd);
- X canvas_locmove_proc = elastic_compoundbox;
- X canvas_middlebut_proc = prescale_compound;
- X canvas_leftbut_proc = canvas_rightbut_proc = null_proc;
- X***************
- X*** 147,156 ****
- X elastic_compoundbox(x, y)
- X int x, y;
- X {
- X! draw_rectbox(fix_x, fix_y, cur_x, cur_y, INV_PAINT, 1);
- X compute_adjustposition(x, y);
- X win_setmouseposition(canvas_swfd, cur_x, cur_y);
- X! draw_rectbox(fix_x, fix_y, cur_x, cur_y, INV_PAINT, 1);
- X }
- X
- X compute_adjustposition(x, y)
- X--- 147,156 ----
- X elastic_compoundbox(x, y)
- X int x, y;
- X {
- X! draw_rectbox(fix_x, fix_y, cur_x, cur_y, INV_PAINT);
- X compute_adjustposition(x, y);
- X win_setmouseposition(canvas_swfd, cur_x, cur_y);
- X! draw_rectbox(fix_x, fix_y, cur_x, cur_y, INV_PAINT);
- X }
- X
- X compute_adjustposition(x, y)
- X***************
- X*** 188,203 ****
- X {
- X float scalex, scaley;
- X
- X! draw_rectbox(fix_x, fix_y, cur_x, cur_y, INV_PAINT, 1);
- X compute_adjustposition(x, y);
- X! erase_compound(compound);
- X
- X scalex = ((float) (cur_x - fix_x)) / (fromx - fix_x);
- X scaley = ((float) (cur_y - fix_y)) / (fromy - fix_y);
- X! scale_compound(compound, scalex, scaley, fix_x, fix_y);
- X
- X! draw_compound(compound);
- X! draw_compoundbox(compound, INV_PAINT);
- X last_position.x = fromx;
- X last_position.y = fromy;
- X new_position.x = cur_x;
- X--- 188,203 ----
- X {
- X float scalex, scaley;
- X
- X! draw_rectbox(fix_x, fix_y, cur_x, cur_y, INV_PAINT);
- X compute_adjustposition(x, y);
- X! erase_compound(cmpnd);
- X
- X scalex = ((float) (cur_x - fix_x)) / (fromx - fix_x);
- X scaley = ((float) (cur_y - fix_y)) / (fromy - fix_y);
- X! scale_compound(cmpnd, scalex, scaley, fix_x, fix_y);
- X
- X! draw_compound(cmpnd);
- X! draw_compoundbox(cmpnd, INV_PAINT);
- X last_position.x = fromx;
- X last_position.y = fromy;
- X new_position.x = cur_x;
- X***************
- X*** 215,221 ****
- X }
- X clean_up();
- X set_action_object(F_SCALE, O_COMPOUND);
- X! set_latestcompound(compound);
- X set_modifiedflag();
- X scale_compound_selected();
- X }
- X--- 215,221 ----
- X }
- X clean_up();
- X set_action_object(F_SCALE, O_COMPOUND);
- X! set_latestcompound(cmpnd);
- X set_modifiedflag();
- X scale_compound_selected();
- X }
- END_OF_FILE
- if test 6874 -ne `wc -c <'scale.c.diff'`; then
- echo shar: \"'scale.c.diff'\" unpacked with wrong size!
- fi
- # end of 'scale.c.diff'
- fi
- if test -f 'spline.c.diff' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'spline.c.diff'\"
- else
- echo shar: Extracting \"'spline.c.diff'\" \(6812 characters\)
- sed "s/^X//" >'spline.c.diff' <<'END_OF_FILE'
- X*** spline.c.p5 Tue Jan 16 17:21:08 1990
- X--- spline.c Fri Mar 16 17:06:23 1990
- X***************
- X*** 22,28 ****
- X extern null_proc();
- X extern set_popupmenu();
- X
- X! extern int cur_line_style, line_thickness;
- X extern float cur_styleval;
- X extern int cur_color;
- X extern int cur_areafill;
- X--- 22,28 ----
- X extern null_proc();
- X extern set_popupmenu();
- X
- X! extern int line_style, line_thickness;
- X extern float cur_styleval;
- X extern int cur_color;
- X extern int cur_areafill;
- X***************
- X*** 35,42 ****
- X extern int arrow_ht, arrow_wid;
- X extern F_compound objects;
- X extern int num_point;
- X- extern int DEBUG;
- X extern F_point *first_point, *cur_point;
- X
- X int create_splineobject();
- X init_spline_drawing();
- X--- 35,42 ----
- X extern int arrow_ht, arrow_wid;
- X extern F_compound objects;
- X extern int num_point;
- X extern F_point *first_point, *cur_point;
- X+ extern appresStruct appres;
- X
- X int create_splineobject();
- X init_spline_drawing();
- X***************
- X*** 70,76 ****
- X draw_elasticline();
- X if (num_point <= 2) {
- X pw_vector(canvas_pixwin, first_point->x, first_point->y,
- X! cur_point->x, cur_point->y, PAINT, 0);
- X if (num_point == 1) free((char*)cur_point);
- X free((char*)first_point);
- X draw_spline_selected();
- X--- 70,76 ----
- X draw_elasticline();
- X if (num_point <= 2) {
- X pw_vector(canvas_pixwin, first_point->x, first_point->y,
- X! cur_point->x, cur_point->y, PAINT, 1, SOLID_LINE, 0.0);
- X if (num_point == 1) free((char*)cur_point);
- X free((char*)first_point);
- X draw_spline_selected();
- X***************
- X*** 77,83 ****
- X return;
- X }
- X Spline_malloc(spline);
- X! spline->style = cur_line_style;
- X spline->thickness = line_thickness;
- X spline->style_val = cur_styleval;
- X spline->color = cur_color;
- X--- 77,83 ----
- X return;
- X }
- X Spline_malloc(spline);
- X! spline->style = line_style;
- X spline->thickness = line_thickness;
- X spline->style_val = cur_styleval;
- X spline->color = cur_color;
- X***************
- X*** 89,95 ****
- X spline->next = NULL;
- X cur_x = cur_y = fix_x = fix_y = 0; /* used in draw_movingpoint */
- X draw_movingpoint(spline->points, INV_PAINT); /* erase control vector */
- X- pw_batch_on(canvas_pixwin);
- X if (cur_command == F_CLOSED_SPLINE) {
- X spline->type = T_CLOSED_NORMAL;
- X spline->for_arrow = NULL;
- X--- 89,94 ----
- X***************
- X*** 98,104 ****
- X /* The current area fill color will be saved in the object if
- X fill_mode is != 0, but the method presently used to draw
- X the spline doesn't easily lend itself to area fill,
- X! so it is not filled.
- X The spline is drawn in sections that aren't adjacent,
- X and have overlapping sections. */
- X spline->area_fill = fill_mode? cur_areafill : 0;
- X--- 97,103 ----
- X /* The current area fill color will be saved in the object if
- X fill_mode is != 0, but the method presently used to draw
- X the spline doesn't easily lend itself to area fill,
- X! so it is drawn not filled.
- X The spline is drawn in sections that aren't adjacent,
- X and have overlapping sections. */
- X spline->area_fill = fill_mode? cur_areafill : 0;
- X***************
- X*** 118,128 ****
- X spline->type = T_OPEN_NORMAL;
- X draw_open_spline(spline, PAINT);
- X }
- X! pw_batch_off(canvas_pixwin);
- X! if (DEBUG) {
- X int xmin, ymin, xmax, ymax;
- X spline_bound(spline, &xmin, &ymin, &xmax, &ymax);
- X! draw_rectbox(xmin, ymin, xmax, ymax, PAINT, 1);
- X }
- X clean_up();
- X insert_spline(&objects.splines, spline);
- X--- 117,126 ----
- X spline->type = T_OPEN_NORMAL;
- X draw_open_spline(spline, PAINT);
- X }
- X! if (appres.DEBUG) {
- X int xmin, ymin, xmax, ymax;
- X spline_bound(spline, &xmin, &ymin, &xmax, &ymax);
- X! draw_rectbox(xmin, ymin, xmax, ymax, PAINT);
- X }
- X clean_up();
- X insert_spline(&objects.splines, spline);
- X***************
- X*** 152,158 ****
- X draw_arrow((int)x2, (int)y2, (int)x1, (int)y1,
- X spline->back_arrow, op);
- X pw_vector(canvas_pixwin, (int)x1, (int)y1, round(cx1),
- X! round(cy1), op, spline->thickness);
- X
- X for (p = p->next; p != NULL; p = p->next) {
- X x1 = x2; y1 = y2;
- X--- 150,157 ----
- X draw_arrow((int)x2, (int)y2, (int)x1, (int)y1,
- X spline->back_arrow, op);
- X pw_vector(canvas_pixwin, (int)x1, (int)y1, round(cx1),
- X! round(cy1), op, spline->thickness,
- X! spline->style, spline->style_val);
- X
- X for (p = p->next; p != NULL; p = p->next) {
- X x1 = x2; y1 = y2;
- X***************
- X*** 160,171 ****
- X cx4 = (x1 + x2) / 2; cy4 = (y1 + y2) / 2;
- X cx3 = (x1 + cx4) / 2; cy3 = (y1 + cy4) / 2;
- X quadratic_spline(cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4, op,
- X! spline->thickness);
- X cx1 = cx4; cy1 = cy4;
- X cx2 = (cx1 + x2) / 2; cy2 = (cy1 + y2) / 2;
- X }
- X pw_vector(canvas_pixwin, round(cx1), round(cy1),
- X! (int)x2, (int)y2, op, spline->thickness);
- X if (spline->for_arrow) /* forward arrow */
- X draw_arrow((int)x1, (int)y1, (int)x2, (int)y2,
- X spline->for_arrow, op);
- X--- 159,171 ----
- X cx4 = (x1 + x2) / 2; cy4 = (y1 + y2) / 2;
- X cx3 = (x1 + cx4) / 2; cy3 = (y1 + cy4) / 2;
- X quadratic_spline(cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4, op,
- X! spline->thickness, spline->style, spline->style_val);
- X cx1 = cx4; cy1 = cy4;
- X cx2 = (cx1 + x2) / 2; cy2 = (cy1 + y2) / 2;
- X }
- X pw_vector(canvas_pixwin, round(cx1), round(cy1),
- X! (int)x2, (int)y2, op, spline->thickness,
- X! spline->style, spline->style_val);
- X if (spline->for_arrow) /* forward arrow */
- X draw_arrow((int)x1, (int)y1, (int)x2, (int)y2,
- X spline->for_arrow, op);
- X***************
- X*** 192,198 ****
- X cx4 = (x1 + x2) / 2; cy4 = (y1 + y2) / 2;
- X cx3 = (x1 + cx4) / 2; cy3 = (y1 + cy4) / 2;
- X quadratic_spline(cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4, op,
- X! spline->thickness);
- X cx1 = cx4; cy1 = cy4;
- X cx2 = (cx1 + x2) / 2; cy2 = (cy1 + y2) / 2;
- X }
- X--- 192,198 ----
- X cx4 = (x1 + x2) / 2; cy4 = (y1 + y2) / 2;
- X cx3 = (x1 + cx4) / 2; cy3 = (y1 + cy4) / 2;
- X quadratic_spline(cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4, op,
- X! spline->thickness, spline->style, spline->style_val);
- X cx1 = cx4; cy1 = cy4;
- X cx2 = (cx1 + x2) / 2; cy2 = (cy1 + y2) / 2;
- X }
- X***************
- X*** 202,206 ****
- X cx4 = (x1 + x2) / 2; cy4 = (y1 + y2) / 2;
- X cx3 = (x1 + cx4) / 2; cy3 = (y1 + cy4) / 2;
- X quadratic_spline(cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4, op,
- X! spline->thickness);
- X }
- X--- 202,206 ----
- X cx4 = (x1 + x2) / 2; cy4 = (y1 + y2) / 2;
- X cx3 = (x1 + cx4) / 2; cy3 = (y1 + cy4) / 2;
- X quadratic_spline(cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4, op,
- X! spline->thickness, spline->style, spline->style_val);
- X }
- END_OF_FILE
- if test 6812 -ne `wc -c <'spline.c.diff'`; then
- echo shar: \"'spline.c.diff'\" unpacked with wrong size!
- fi
- # end of 'spline.c.diff'
- fi
- if test -f 'xtra.c.diff' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'xtra.c.diff'\"
- else
- echo shar: Extracting \"'xtra.c.diff'\" \(7317 characters\)
- sed "s/^X//" >'xtra.c.diff' <<'END_OF_FILE'
- X*** xtra.c.p5 Mon Mar 12 13:26:43 1990
- X--- xtra.c Mon Mar 26 15:38:54 1990
- X***************
- X*** 11,20 ****
- X #include "resources.h"
- X #include "paintop.h"
- X #include "font.h"
- X
- X! extern int cur_thickness[];
- X! extern PIX_FONT lookfont();
- X
- X /* print "string" in window "w" using font number "font" and size "size" */
- X
- X pw_text(w, x, y, op, font, size, string)
- X--- 11,22 ----
- X #include "resources.h"
- X #include "paintop.h"
- X #include "font.h"
- X+ #include "object.h"
- X
- X! extern int gc_thickness[], gc_line_style[];
- X
- X+ extern PIX_FONT lookfont();
- X+
- X /* print "string" in window "w" using font number "font" and size "size" */
- X
- X pw_text(w, x, y, op, font, size, string)
- X***************
- X*** 22,33 ****
- X int x, y, op, font, size;
- X char *string;
- X {
- X! if (cur_gcfont[op] != font || cur_gcfontsize[op] != size)
- X {
- X canvas_font = lookfont(font,size);
- X XSetFont(tool_d, gccache[op], canvas_font->fid);
- X! cur_gcfont[op] = font;
- X! cur_gcfontsize[op] = size;
- X }
- X XDrawString(tool_d, w, gccache[op], x, y, string, strlen(string));
- X }
- X--- 24,35 ----
- X int x, y, op, font, size;
- X char *string;
- X {
- X! if (gc_font[op] != font || gc_fontsize[op] != size)
- X {
- X canvas_font = lookfont(font,size);
- X XSetFont(tool_d, gccache[op], canvas_font->fid);
- X! gc_font[op] = font;
- X! gc_fontsize[op] = size;
- X }
- X XDrawString(tool_d, w, gccache[op], x, y, string, strlen(string));
- X }
- X***************
- X*** 166,191 ****
- X XGCValues gcv;
- X int i;
- X
- X! gcv.fill_style = FillStippled; /* Tiled */;
- X gcv.arc_mode = ArcPieSlice; /* fill mode for arcs */
- X for (i=0; i<NUMFILLPATS; i++)
- X {
- X- /******************************************************
- X- fill_pm[i] = XCreatePixmapFromBitmapData(tool_d, XtWindow(canvas_sw),
- X- fill_images[i],8,8,
- X- x_fg_color.pixel,x_bg_color.pixel,
- X- DefaultDepthOfScreen(tool_s));
- X- *******************************************************/
- X /* if we want the area fill to be "meshed" on top of existing
- X filled objects, then we must use stippling. This means
- X creating a one-plane bitmap and setting the stipple part
- X! of the gc and selecting stipple fill mode. This created
- X! a problem on the color machines in that it picked random
- X! colors to paint the stipple. It should have used the
- X! foreground color in the given gc with the FillPolygon call,
- X! but it didn't.
- X */
- X- /* use the following for stippling */
- X fill_pm[i] = XCreateBitmapFromData(tool_d, XtWindow(canvas_sw),
- X fill_images[i],8,8);
- X /* create pixmaps of area-fill colors for indicator */
- X--- 168,183 ----
- X XGCValues gcv;
- X int i;
- X
- X! gcv.fill_style = FillOpaqueStippled;
- X gcv.arc_mode = ArcPieSlice; /* fill mode for arcs */
- X+ gcv.fill_rule = EvenOddRule/*WindingRule*/;
- X for (i=0; i<NUMFILLPATS; i++)
- X {
- X /* if we want the area fill to be "meshed" on top of existing
- X filled objects, then we must use stippling. This means
- X creating a one-plane bitmap and setting the stipple part
- X! of the gc and selecting stipple fill mode.
- X */
- X fill_pm[i] = XCreateBitmapFromData(tool_d, XtWindow(canvas_sw),
- X fill_images[i],8,8);
- X /* create pixmaps of area-fill colors for indicator */
- X***************
- X*** 196,203 ****
- X fill_gc[i] = makegc(PAINT, x_fg_color.pixel, x_bg_color.pixel);
- X un_fill_gc[i] = makegc(ERASE, x_fg_color.pixel, x_bg_color.pixel);
- X gcv.stipple = fill_pm[i];
- X! XChangeGC(tool_d, fill_gc[i], GCStipple|GCFillStyle|GCArcMode, &gcv);
- X! XChangeGC(tool_d, un_fill_gc[i], GCStipple|GCFillStyle|GCArcMode, &gcv);
- X }
- X }
- X
- X--- 188,197 ----
- X fill_gc[i] = makegc(PAINT, x_fg_color.pixel, x_bg_color.pixel);
- X un_fill_gc[i] = makegc(ERASE, x_fg_color.pixel, x_bg_color.pixel);
- X gcv.stipple = fill_pm[i];
- X! XChangeGC(tool_d, fill_gc[i],
- X! GCStipple|GCFillStyle|GCFillRule|GCArcMode, &gcv);
- X! XChangeGC(tool_d, un_fill_gc[i],
- X! GCStipple|GCFillStyle|GCArcMode, &gcv);
- X }
- X }
- X
- X***************
- X*** 369,401 ****
- X XtAddConverter("Int", "Float", CvtIntToFloat, NULL, 0);
- X }
- X
- X! pw_vector(w, x1, y1, x2, y2, op, line_width)
- X Window w;
- X! int x1, y1, x2, y2, op, line_width;
- X {
- X! set_line_width(line_width,op);
- X XDrawLine(tool_d, w, gccache[op], x1, y1, x2, y2);
- X }
- X
- X!
- X! pw_put(w, x, y, op, line_width)
- X! Window w;
- X! int x,y,op,line_width;
- X {
- X- op = op? PAINT : ERASE;
- X- set_line_width(line_width,op);
- X- XDrawPoint(tool_d, w, gccache[op], x, y);
- X- }
- X-
- X- pw_lines(w, points, npoints, op, line_width, area_fill)
- X- Window w;
- X- int npoints;
- X- XPoint *points;
- X- int op,line_width,area_fill;
- X- {
- X GC gc;
- X
- X- set_line_width(line_width,op);
- X if (area_fill)
- X {
- X if (op == PAINT)
- X--- 363,388 ----
- X XtAddConverter("Int", "Float", CvtIntToFloat, NULL, 0);
- X }
- X
- X! pw_vector(w, x1, y1, x2, y2, op, line_width, line_style, style_val)
- X Window w;
- X! int x1, y1, x2, y2, op, line_width, line_style;
- X! float style_val;
- X {
- X! if (line_width == 0)
- X! return;
- X! set_line_stuff(line_width,line_style,style_val,op);
- X XDrawLine(tool_d, w, gccache[op], x1, y1, x2, y2);
- X }
- X
- X! pw_lines(w, points, npoints, op, line_width, line_style, style_val, area_fill)
- X! Window w;
- X! int npoints;
- X! XPoint *points;
- X! int op,line_width,line_style,area_fill;
- X! float style_val;
- X {
- X GC gc;
- X
- X if (area_fill)
- X {
- X if (op == PAINT)
- X***************
- X*** 405,432 ****
- X XFillPolygon(tool_d, w, gc, points, npoints,
- X Complex, CoordModeOrigin);
- X }
- X XDrawLines(tool_d, w, gccache[op], points, npoints, CoordModeOrigin);
- X }
- X
- X! pw_rectangle(w, x, y, width, height, op, line_width)
- X! Window w;
- X! int x,y,width,height;
- X! int op,line_width;
- X {
- X- set_line_width(width,op);
- X- XDrawRectangle(tool_d, w, gccache[op], x, y, width, height);
- X- }
- X-
- X- set_line_width(width,op)
- X- int width,op;
- X- {
- X XGCValues gcv;
- X
- X! if (width != cur_thickness[op])
- X {
- X! gcv.line_width = width == 1? 0: width; /* use 0 width for 1 (much faster) */
- X! XChangeGC(tool_d, gccache[op], GCLineWidth, &gcv);
- X! cur_thickness[op] = width;
- X }
- X }
- X-
- X--- 392,432 ----
- X XFillPolygon(tool_d, w, gc, points, npoints,
- X Complex, CoordModeOrigin);
- X }
- X+ if (line_width == 0)
- X+ return;
- X+ set_line_stuff(line_width, line_style, style_val, op);
- X XDrawLines(tool_d, w, gccache[op], points, npoints, CoordModeOrigin);
- X }
- X
- X! set_line_stuff(width,style,style_val,op)
- X! int width,style,op;
- X! float style_val;
- X {
- X XGCValues gcv;
- X+ unsigned long mask;
- X+ char dash_list[2];
- X
- X! if (width == gc_thickness[op] && style == gc_line_style[op])
- X! return;
- X! gcv.line_width = (width == 1? 0: width); /* use 0 width for 1 (much faster) */
- X! mask = GCLineWidth|GCLineStyle;
- X! gcv.line_style = (style==SOLID_LINE)? LineSolid: LineOnOffDash;
- X! if (style==SOLID_LINE)
- X! XChangeGC(tool_d, gccache[op], mask, &gcv);
- X! else
- X! {
- X! mask |= GCDashList;
- X! if (style_val > 0.0) /* style_val of 0.0 causes problems */
- X {
- X! gcv.dashes = (char) style_val;
- X! XChangeGC(tool_d, gccache[op], mask, &gcv);
- X! /* length of ON/OFF pixels */
- X! dash_list[0]=dash_list[1] = (char) style_val;
- X! if (style == DOTTED_LINE)
- X! dash_list[0] = 1; /* length of ON pixels for dotted */
- X! XSetDashes(tool_d, gccache[op], 0, dash_list, 2);
- X }
- X+ }
- X+ gc_thickness[op] = width;
- X+ gc_line_style[op] = style;
- X }
- END_OF_FILE
- if test 7317 -ne `wc -c <'xtra.c.diff'`; then
- echo shar: \"'xtra.c.diff'\" unpacked with wrong size!
- fi
- # end of 'xtra.c.diff'
- fi
- echo shar: End of archive 3 \(of 7\).
- cp /dev/null ark3isdone
- MISSING=""
- for I in 1 2 3 4 5 6 7 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 7 archives.
- rm -f ark[1-9]isdone
- else
- echo You still need to unpack the following archives:
- echo " " ${MISSING}
- fi
- ## End of shell archive.
- exit 0
-
- dan
- -----------------------------------------------------------
- O'Reilly && Associates
- argv@sun.com / argv@ora.com
- 632 Petaluma Ave, Sebastopol, CA 95472
- 800-338-NUTS, in CA: 800-533-NUTS, FAX 707-829-0104
- Opinions expressed reflect those of the author only.
-